home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.util.coll;
-
- import com.sun.java.util.collections.Iterator;
- import com.sun.java.util.collections.UnsupportedOperationException;
-
- public abstract class BasicIterator implements Iterator {
- Object onDeck = null;
- Object atBat = null;
- boolean init = false;
-
- private void init() {
- if (!this.init) {
- this.onDeck = this.getNext();
- this.atBat = null;
- this.init = true;
- }
-
- }
-
- public boolean hasNext() {
- this.init();
- return this.onDeck != null;
- }
-
- public Object next() {
- this.init();
- this.atBat = this.onDeck;
- this.onDeck = this.getNext();
- return this.atBat;
- }
-
- public void remove() {
- if (this.atBat == null) {
- throw new IllegalStateException();
- } else {
- this.removeItem(this.atBat);
- this.atBat = null;
- }
- }
-
- protected void removeItem(Object var1) {
- throw new UnsupportedOperationException();
- }
-
- protected abstract Object getNext();
- }
-